package it.polimi.TravelDreamEAR.ejb.entities;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the amico database table.
 * 
 */
@Embeddable
public class AmicoPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(name="CODICE_FISCALE")
	private String codiceFiscale;

	@Column(insertable=false, updatable=false)
	private String cliente;

	@Column(insertable=false, updatable=false)
	private String istanza;

	public AmicoPK() {
	}
	public String getCodiceFiscale() {
		return this.codiceFiscale;
	}
	public void setCodiceFiscale(String codiceFiscale) {
		this.codiceFiscale = codiceFiscale;
	}
	public String getCliente() {
		return this.cliente;
	}
	public void setCliente(String cliente) {
		this.cliente = cliente;
	}
	public String getIstanza() {
		return this.istanza;
	}
	public void setIstanza(String istanza) {
		this.istanza = istanza;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof AmicoPK)) {
			return false;
		}
		AmicoPK castOther = (AmicoPK)other;
		return 
			this.codiceFiscale.equals(castOther.codiceFiscale)
			&& this.cliente.equals(castOther.cliente)
			&& (this.istanza == castOther.istanza);
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.codiceFiscale.hashCode();
		hash = hash * prime + this.cliente.hashCode();
		hash = hash * prime + this.istanza.hashCode();
		
		return hash;
	}
}